\(\int \csc (x) (a \cos (x)+b \sin (x)) \, dx\) [5]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 9 \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=b x+a \log (\sin (x)) \]

[Out]

b*x+a*ln(sin(x))

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3164, 3556} \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=a \log (\sin (x))+b x \]

[In]

Int[Csc[x]*(a*Cos[x] + b*Sin[x]),x]

[Out]

b*x + a*Log[Sin[x]]

Rule 3164

Int[sin[(c_.) + (d_.)*(x_)]^(m_)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Symb
ol] :> Int[(b + a*Cot[c + d*x])^n, x] /; FreeQ[{a, b, c, d}, x] && EqQ[m + n, 0] && IntegerQ[n] && NeQ[a^2 + b
^2, 0]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \int (b+a \cot (x)) \, dx \\ & = b x+a \int \cot (x) \, dx \\ & = b x+a \log (\sin (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.56 \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=b x+a \log (\cos (x))+a \log (\tan (x)) \]

[In]

Integrate[Csc[x]*(a*Cos[x] + b*Sin[x]),x]

[Out]

b*x + a*Log[Cos[x]] + a*Log[Tan[x]]

Maple [A] (verified)

Time = 0.36 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.11

method result size
default \(x b +a \ln \left (\sin \left (x \right )\right )\) \(10\)
parts \(-a \ln \left (\csc \left (x \right )\right )+x b\) \(11\)
risch \(x b -i a x +a \ln \left ({\mathrm e}^{2 i x}-1\right )\) \(20\)
parallelrisch \(x b +a \ln \left (\csc \left (x \right )-\cot \left (x \right )\right )-a \ln \left (\frac {2}{\cos \left (x \right )+1}\right )\) \(27\)
norman \(\frac {x b +x b \tan \left (\frac {x}{2}\right )^{2}}{1+\tan \left (\frac {x}{2}\right )^{2}}+a \ln \left (\tan \left (\frac {x}{2}\right )\right )-a \ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )\) \(45\)

[In]

int(csc(x)*(a*cos(x)+b*sin(x)),x,method=_RETURNVERBOSE)

[Out]

x*b+a*ln(sin(x))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.22 \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=b x + a \log \left (\frac {1}{2} \, \sin \left (x\right )\right ) \]

[In]

integrate(csc(x)*(a*cos(x)+b*sin(x)),x, algorithm="fricas")

[Out]

b*x + a*log(1/2*sin(x))

Sympy [A] (verification not implemented)

Time = 0.51 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.89 \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=a \log {\left (\sin {\left (x \right )} \right )} + b x \]

[In]

integrate(csc(x)*(a*cos(x)+b*sin(x)),x)

[Out]

a*log(sin(x)) + b*x

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00 \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=b x + a \log \left (\sin \left (x\right )\right ) \]

[In]

integrate(csc(x)*(a*cos(x)+b*sin(x)),x, algorithm="maxima")

[Out]

b*x + a*log(sin(x))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 24 vs. \(2 (9) = 18\).

Time = 0.28 (sec) , antiderivative size = 24, normalized size of antiderivative = 2.67 \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=b x - a \log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right ) + a \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right ) \]

[In]

integrate(csc(x)*(a*cos(x)+b*sin(x)),x, algorithm="giac")

[Out]

b*x - a*log(tan(1/2*x)^2 + 1) + a*log(abs(tan(1/2*x)))

Mupad [B] (verification not implemented)

Time = 21.16 (sec) , antiderivative size = 54, normalized size of antiderivative = 6.00 \[ \int \csc (x) (a \cos (x)+b \sin (x)) \, dx=a\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )-a\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-\mathrm {i}\right )-a\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )-b\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-\mathrm {i}\right )\,1{}\mathrm {i}+b\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i} \]

[In]

int((a*cos(x) + b*sin(x))/sin(x),x)

[Out]

a*log(tan(x/2)) - a*log(tan(x/2) - 1i) - a*log(tan(x/2) + 1i) - b*log(tan(x/2) - 1i)*1i + b*log(tan(x/2) + 1i)
*1i